<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable('lesson_hour')) { return; }

        Schema::create('lesson_hour', function (Blueprint $table) {
            $table->id()->unique();
            $table->integer('customer_id')->comment('顾客id');
            $table->integer('lessons')->comment('课时长度');
            $table->tinyInteger('type')->default(1)->comment('课时类型，1：学员约课，2：额外赠课，3：额外扣除，4：预约课时');
            $table->string('desc', 255)->comment('描述，用户可见');
            $table->tinyInteger('lesson_status')->default(1)->comment('课时状态，1：已到账，2：审核中，3：冻结中，4：已驳回');
            $table->text('remark')->comment('备注');
            $table->integer('teacher_id')->comment('教师id');
            $table->integer('reservation_id')->comment('预约记录id');
            $table->creatorId();
            $table->createdAt();
            $table->updatedAt();

            $table->engine='InnoDB';
            $table->comment('课时管理');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('lesson_hour');
    }
};
